Page({

  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      //反馈消息录入list数据库
      wx.cloud.callFunction({
        name: 'record',
        data: {
          "path": this.route,
          "query": 'index=1'
        },
        success: function (res) {
          console.log(res)
        },
        fail: function (err) {
          console.log(err)
        }
      })
    },
    async bindFormSubmit (e) {
      const { options } = e.detail.value
      if (options === '' || options === null || options === undefined) {
        wx.showToast({
          title: '请输入反馈内容',
          icon: 'none',
          duration: 1500
        })
        return false
      }
      const params = {
        content: options,
        createAt: new Date(),
        updateAt: new Date(),
        status: 0, // 0未处理，1已处理
        feedback: ''
      }
      const db = wx.cloud.database()
      const res = await db.collection('list').add({
        data: {...params}
      })
      wx.showToast({
        title: '反馈成功，感谢您的支持',
        icon: 'none',
        duration: 2000
      })
      let timmer = setTimeout(() => {
        clearTimeout(timmer)
        timmer = null
        wx.navigateBack({ delta: 1 })
      }, 2000)
    },
})